package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserInfoApi;
import com.tanhua.model.domain.db.UserInfo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/*
 * 处理userinfo的业务实现
 * */
@Service
public class UserInfoService {

    @DubboReference
    private UserInfoApi userInfoApi;

    public void save(UserInfo userInfo) {
        //远程调用持久操作
        userInfoApi.saveOrUpdate(userInfo);
    }

    /**
     * 保存头像
     * @param id
     * @param headUrl 头像存储阿里云oss的位置
     */
    public void saveHead(Long id, String headUrl) {
        UserInfo userInfo=new UserInfo();
        userInfo.setId(id);
        userInfo.setAvatar(headUrl);
        userInfoApi.saveOrUpdate(userInfo);
    }
}

